from bigdata.labels import Hive_process

if __name__ == '__main__':
    hive = Hive_process.Hive_process()
    #客单价
    goods_df = hive.read('shopping.tbl_goods')
    #将价格转为float
    goods_df = goods_df.withColumn("price", goods_df['price'].cast('float'))
    goods_df.printSchema()
    avg_product =  goods_df.groupby('productId')\
    .avg('price')